package com.yc.framework.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "ip.limit")
public class IpLimitConfig {

    // 单个接口访问次数限制
    private int maxRequestPerMinute = 60;

    // 登录/注册接口访问次数限制
    private int maxLoginRequestPerMinute = 5;

    // 连续触发限制的次数，超过后禁用账户
    private int maxViolationCount = 3;

    // 禁用时长（分钟）
    private int banMinutes = 30;

    public int getMaxRequestPerMinute() {
        return maxRequestPerMinute;
    }

    public void setMaxRequestPerMinute(int maxRequestPerMinute) {
        this.maxRequestPerMinute = maxRequestPerMinute;
    }

    public int getMaxLoginRequestPerMinute() {
        return maxLoginRequestPerMinute;
    }

    public void setMaxLoginRequestPerMinute(int maxLoginRequestPerMinute) {
        this.maxLoginRequestPerMinute = maxLoginRequestPerMinute;
    }

    public int getMaxViolationCount() {
        return maxViolationCount;
    }

    public void setMaxViolationCount(int maxViolationCount) {
        this.maxViolationCount = maxViolationCount;
    }

    public int getBanMinutes() {
        return banMinutes;
    }

    public void setBanMinutes(int banMinutes) {
        this.banMinutes = banMinutes;
    }
}